'use strict';

/**
 * Created by zhu on 14/12/18.
 */
var blog = angular.module('blog');

/**
 * 目录初始化
 */
blog.factory('BlogCategoryQueryService', ['$resource', 'RootPathConstant', function ($resource, RootPathConstant) {
    return $resource(RootPathConstant + '/blog/categories/author/:author', {}, {
        query: {method: 'GET', isArray: true}
    });
}]);

/**
 * 目录管理modal
 */
blog.factory('BlogCategoryModalService', ['btfModal', function (btfModal) {
    return btfModal({
        controller: 'BlogCategoryManagementCtrl',
        controllerAs: 'categoryModal',
        templateUrl: 'views/blog/blog_category_management.html'
    });
}]);

/**
 * 目录修改
 */
blog.factory('BlogCategoryModifyService', ['$resource', 'RootPathConstant', function ($resource, RootPathConstant) {
    return $resource(RootPathConstant + '/blog/category/:id', {}, {
        remove: {method: 'DELETE', isArray: false},
        save:   {method: 'POST',   isArray: false},
        modify: {method: 'PUT',    isArray: false}
    });
}]);
